package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    List<ShoppingCart> list(ShoppingCart shoppingCart);


    // 注意这里是根据id,不是菜品或者套餐的id，是购物车数据库的主键id，这是唯一的
    @Update("update shopping_cart set number = #{number} where id = #{id}")
    void updateNumber(ShoppingCart cart);

    void insert(ShoppingCart shoppingCart);

    @Delete("delete from shopping_cart")
    void delete();

    @Delete("delete from shopping_cart where id = #{id}")
    void deleteChoose(ShoppingCart cart);

    void insertBatch(List<ShoppingCart> shoppingCartList);
}
